export default (url) => {
  const crud = window.$crud(url);
  crud.addList = (data) =>
    window.$axios({
      url: `${url}s`,
      method: "post",
      data,
    });

  crud.updateState = (id) =>
    window.$axios({
      url: `${url}/state/${id}`,
      method: "put",
    });

  const apiPost = (url, params, headers) =>
    window.$axios({
      url,
      method: "post",
      data: params,
      headers,
    });

  const apiGet = (url, params, headers) =>
    window.$axios({
      url,
      method: "get",
      params,
      headers,
    });

  return {
    ...crud,
    apiPost,
    apiGet,
  };
};
